{% extends 'wgs/测序数据质控/qc.html'%}
{%block background%}
<h1>CNV变异统计</h1>
<p>
    拷贝数变异（CNV）由基因组重排导致，一般指长度1kb以上的基因组大片段拷贝数增加或者减少，主要表现为亚显微水平的缺失和重复，会影响到基因组的稳定性、基因的功能。
</p>
{%endblock%}
{%block parameter%}
<h3>分析软件</h3>
<p>分析软件：CNVnator</p>
{%endblock%}

{%block tab%}
<ul class="layui-tab-title">
    <li class='layui-this'>CNV数据统计</li>
    <li>CNV长度分布</li>
</ul>
<div class="layui-tab-content">
    <div class="layui-tab-item layui-show">
        <div id="CNV数据统计"></div>
    </div>
    <div id="CNV长度分布" class="layui-tab-item ">
        <div class="layui-row layui-col-space20">
            <div class="layui-col-xs12">
                <form class="layui-form">
                    <select id='tab1' lay-filter='tab1'>
                        {% for key in dict_sub %}
                        <option value={{key}} name={{key}} selected>{{key}}</option>
                        {% endfor %}
                    </select>
                </form>
            </div>
        </div>

        <div class="layui-row layui-col-space20">
            <div class="layui-col-x12">

                <div class="layui-col-xs12">
                    <label class="sample_label">CNV长度小提琴图：</label>
                    <img class="tab1_img"
                        style="width:50%;margin-top: 25px;margin-bottom: 50px;margin-right: auto;margin-left: auto;display: block"
                        src="CNV_distribution.png" />
                </div>

            </div>
        </div>

        <div>
            <p>注： 横坐标表示Deletion/Duplication类型；纵坐标表示CNV的长度。</p>
        </div>
    </div>
</div>
</div>
{%endblock%}
{%block js%}
<script>
    var $ = layui.jquery, table = layui.table;
    table.render({
        elem: '#CNV数据统计'
        , height: 500
        , loading: true
        , url: "{{url('wgs:cnv_table',args=(analysis,))}}"     // 数据接口
        , toolbar: true, defaultToolbar: ['filter', 'exports', 'print']
        , cellMinWidth: 120 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
        , page: true
        , cols: [[
            { field: 'id', title: 'id', sort: true, hide: true }
            , { field: 'Samples', width: 160, title: 'Samples', sort: true }
            , { field: 'TotalDEL', title: 'TotalDEL' }
            , { field: 'TotalDUP', title: 'TotalDUP' }
            , { field: 'Overlapped_gene', title: 'Overlapped_gene' }
            , { field: 'over_1KB_DEL', title: '> 1KB DEL' }
            , { field: 'over_5KB_DEL', title: '> 5KB DEL' }
            , { field: 'over_10KB_DEL', title: '> 10KB DEL' }
            , { field: 'over_100KB_DEL', title: '> 100KB DEL' }
            , { field: 'over_1000KB_DEL', title: '> 1000KB DEL' }
            , { field: 'over_1KB_DUP', title: '> 1KB DUP' }
            , { field: 'over_5KB_DUP', title: '> 5KB DUP' }
            , { field: 'over_10KB_DUP', title: '> 10KB DUP' }
            , { field: 'over_100KB_DUP', title: '> 100KB DUP' }
            , { field: 'over_1000KB_DUP', title: '> 1000KB DUP' }
        ]]
    });

</script>
<script>
    var $ = layui.jquery, form = layui.form;
    var sample = $('#tab1').val();
    function tab1_link(sample) {
        var link = "/media/{{username}}/{{project}}/{{analysis}}/CNV/" + sample + "/CNV_distribution.png";
        $('.sample_label').text(sample + ' ' + "CNV长度小提琴图：");
        $('.tab1_img').attr('src', link);
    }
    tab1_link(sample);
    form.on('select(tab1)', function (data) {
        var sample = data.value;
        tab1_link(sample);
    })
</script>
{%endblock%}